package com.aoxin.util.enumerate;

import com.aoxin.util.ErrorUtil;

/**
 * 文章类型
 */
public enum  ArticleType {
    SYSTEM(1,"系统文章"),NEWS(2,"新闻动态");
    private int id;

    private String value;
    private ArticleType(int id,String value){
        this.id = id;
        this.value = value;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }
    public static ArticleType fromId(int id) {
        switch (id) {
            case 1:
                return SYSTEM;
            case 2:
                return NEWS;
        }
        throw new RuntimeException(String.format(ErrorUtil.OPERATE_TYPE, id));
    }
}
